const defaultState = {
  menu: "2",
  width: null,
};

const state = () => {
  return defaultState;
};

const mutations = {
  menuChange(state: typeof defaultState, currentMenu: any) {
    state.menu = currentMenu;
  },
  menuWidthChange(state: typeof defaultState, width: any) {
    state.width = width;
  },
};

const actions = {
  changeMenu(context: any,currentMenu: any) {
    context.commit("menuChange",currentMenu);
  },
  changeMenuWidth(context: any, width: any) {
    console.log(width);
    
    context.commit("menuWidthChange", parseInt(width));
  },
};

const getters = {
  currentMenu(state: typeof defaultState) {
    return state.menu;
  },
  currentMenuWidth(state: typeof defaultState) {
    return state.width;
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
